//
//  NSString+TL_NSString.h
//  WXReader
//
//  Created by Andrew on 2019/4/5.
//  Copyright © 2019 Andrew. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (TL_NSString)

- (NSString *)fileSize;

- (NSString *)safe_substringWithRange:(NSRange)range;

- (BOOL)isChinese;

- (BOOL)isLetter;

- (BOOL)containChinese;

/// 获取正确的网络URL路径
- (NSString *)wx_url;

- (NSString *)firstCapitalized;

/// 获取###包含的特殊文字，NSArray表示的是所有特殊文字的区间
- (NSDictionary<NSString *, NSArray *> *)resetTextWithString;

/// 替换指定区间的字符串，返回替换后的字符串和替换后指定字符串的区间
- (NSDictionary<NSString *, NSArray *> *)stringByReplacingCharactersInRanges:(NSArray *)ranges strings:(NSArray<NSString *> *)strings;


/// 拼接URL的后面参数部分，会自动判断是否需要添加？
/// @discussion 仅适用于拼接URL，不适用于普通字符串。
/// @code
/// NSString *old_url1 = @"http://www.baidu.com/data/landingsuper";
/// NSString *url1 = [old_url1 wx_urlWithString:@"uid=2"];
/// url1 => @"http://www.baidu.com/data/landingsuper?uid=2";
///
/// NSString *old_url2 = @"http://www.baidu.com/data/landingsuper?context=56";
/// NSString *url2 = [old_url2 wx_urlWithString:@"uid=2"];
/// url2 => @"http://www.baidu.com/data/landingsuper?context=56&uid=2";
/// @encode
- (NSString *)wx_urlWithString:(NSString *)string;
- (BOOL)TL_validateEmail;
@end

NS_ASSUME_NONNULL_END
